Skip to content

RR Edge ID Verification #3164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 1, 2025
Merged

RR Edge ID Verification #3164

merged 12 commits into from
Jul 1, 2025

Conversation

amin1377
Copy link
Contributor

Description

In a .route file, each edge between two nodes includes a switch ID, which is used to retrieve the electrical characteristics of that edge. When reading the .route file, this switch ID is compared against the corresponding switch ID from the RR Graph for consistency. If they do not match, an error is raised.

This consistency check is generally helpful. However, when analyzing multiple timing corners, each corner may have a different RR Graph with varying timing information (graph topologies are the same). As a result, the number and ordering of switch types may differ between corners. To allow reuse of the same .route file for fair comparisons across different timing corners, this strict verification can become a limitation.

To address this issue, a new CLI parameter verify_rr_switch_id has been introduced. By default, it is set to on, enforcing the consistency check. When set to off, the switch ID from the .route file is ignored, and the switch ID from the RR Graph is used instead.

@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool lang-cpp C/C++ code labels Jun 24, 2025
Copy link
Contributor

@soheilshahrouz soheilshahrouz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amin1377.

I left a few comment for improving the readability a bit.

Copy link
Contributor

@vaughnbetz vaughnbetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there may be some code duplication ... I suggest some changes.

@vaughnbetz
Copy link
Contributor

vaughnbetz commented Jul 1, 2025 via email

@github-actions github-actions bot added the docs Documentation label Jul 1, 2025
@amin1377
Copy link
Contributor Author

amin1377 commented Jul 1, 2025

Thanks @soheilshahrouz and @vaughnbetz for reviewing the code. Please let me know if you have any further suggestions.

Copy link

@vaughnb-cerebras vaughnb-cerebras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I suggest a couple more changes.

One more thought: should we validate the switch_ids sometimes and not others (what the code is currently doing) or should we just always recompute them on reading in a route file? We don't have to change it, but thought I'd ask ... maybe we're writing out redundant information and then correcting it. In that case not writing out the redundant information at all might be better (although changing the .route format would cause some backwards-incompatibility).


if (trace->iswitch == OPEN) { //End of a branch
//Verify that the next element (branch point) has been already seen in the traceback so far
if (!seen_rr_nodes.count(next->index)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check that index is a valid rr_node index (otherwise the validator could crash on invalid input). Print a helpful error message if it is out of range.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate_and_update_traceback is called within the process_nodes function. In this function, all relevant checks related to the node are performed when creating the trace.

@vaughnb-cerebras
Copy link

vaughnb-cerebras commented Jul 1, 2025 via email

@amin1377
Copy link
Contributor Author

amin1377 commented Jul 1, 2025

Thanks. I suggest a couple more changes.

One more thought: should we validate the switch_ids sometimes and not others (what the code is currently doing) or should we just always recompute them on reading in a route file? We don't have to change it, but thought I'd ask ... maybe we're writing out redundant information and then correcting it. In that case not writing out the redundant information at all might be better (although changing the .route format would cause some backwards-incompatibility).

I think having this additional check is useful, especially now that we have an option to disable it if needed.

In the .route file, the switch ID is also printed, which has actually helped me a few times when debugging routing. Otherwise, I would have had to find the edge ID between two nodes from the RR graph file first to extract the information I needed.

Copy link
Contributor

@vaughnbetz vaughnbetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vaughnbetz vaughnbetz merged commit 8447e3b into master Jul 1, 2025
33 checks passed
@vaughnbetz vaughnbetz deleted the verify_rr_edge_id branch July 1, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation lang-cpp C/C++ code VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants